package com.sgzn.sgpay.exception;

import lombok.Getter;

/**
 * 公共异常类
 * @author zhongzhongyong
 * @version Id: SgpayException.java, v 0.1 2018/4/1 12:00 zhongzhongyong Exp $$
 */
public class SgpayException extends RuntimeException {
    @Getter
    private final String code;
    @Getter
    private final String desc;

    public SgpayException(String code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public SgpayException(String code, String desc, Throwable throwable) {
        super(throwable);
        this.code = code;
        this.desc = desc;
    }

    public SgpayException(String code, String desc, String message) {
        super(message);
        this.code = code;
        this.desc = desc;
    }

    public SgpayException(String code, String desc, String message, Throwable throwable) {
        super(message, throwable);
        this.code = code;
        this.desc = desc;
    }

    @Override
    public String getMessage(){
        return "["+this.code+"]"+this.getDesc();
    }

}
